﻿function pageLoad(sender, args)
{
     $addHandler($get("btnSave"),"click",SaveEmail);
}
//保存我的新邮箱
function SaveEmail()
{
WebServices.My.ValiEmail($('nemail').value,onsucc2);
}
function onsucc(result)
 {
      if(result)
     { 
        $('MessagesBox').style.display='block';
        $('MessageText').innerHTML=ST220.replace(/\{0\}/gi,$('nemail').value);
       $('nemail').value="";                           
      
     }else
     {
       $('MessagesBox').style.display='block';
       $('MessageText').innerHTML=UR009;
     }
    showProgressBar(false);
    $('btnSave').disabled=false;
    upemail(3);
    $('imgemail').style.display="none";
    $('RMemberCrtNo').style.display="none";
    $('Password1').value=""; 
 }
 function upemail(a)
 {
 if(a!=3)
 {
 $get("MessagesBox").style.display='none';
 }
     if(a==1)
     {
         for(var i=0;i<3;i++)
         {
          $('upemail'+i).style.display=""; 
         }
         $('cha').style.display="none";
     }else
    {
         for(var i=0;i<3;i++)
         {
          $('upemail'+i).style.display="none"; 
         }
     $('cha').style.display="";
     $('nemail').value="";
     $('Password1').value="";
     
     $('RMemberCrtNo').style.display="none"; 
  }
 }
 
 
  function conceal(a)
{
if(a=='sMemberCrtNo')
{
$('RMemberCrtNo').style.display="none";
 $('imgemail').src="/Images/loading.gif" ;
$('imgemail').style.display="";
var re = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/;
 if($get("nemail").value.search(re))
 {
    $('RMemberCrtNo').style.display=""; 
    $('imgemail').style.display="none"; 
    return;
}else
{
  WebServices.My.ValiEmail($('nemail').value,onsucc1);
  }  
}
}
function onsucc1(result)
{
    if(result==1)
    {
       $('imgemail').src="/Images/action_delete.gif" ;
       $('RMemberCrtNo').style.display="";
       $('RMemberCrtNo').innerHTML="<br />"+UR018
    }else if(result==2)
    {
        $('imgemail').src="/Images/action_stop.gif" ;
        $('RMemberCrtNo').style.display="";
        $('RMemberCrtNo').innerHTML="<br />"+busy;
    } else if(result==0)
    {
        $('imgemail').src="/Images/action_check.gif" ;
    }
}
function onsucc2(result)
{  
 if(!$ValidButton$()){return;}
    if(result==1)
    {
       $('imgemail').src="/Images/action_delete.gif" ;
       $('RMemberCrtNo').style.display="";
       $('RMemberCrtNo').innerHTML="<br />"+UR018
       return;
    }else if(result==2)
    {
        $('imgemail').src="/Images/action_stop.gif" ;
        $('RMemberCrtNo').style.display="";
        $('RMemberCrtNo').innerHTML="<br />"+busy;
        return;
    } else if(result==0)
    {
        $('imgemail').src="/Images/action_check.gif" ;
        
showProgressBar(true);
$('btnSave').disabled=true;
 var pwd="";
 pwd= $('Password1').value;
 var nemail="";
 nemail=$('nemail').value;
WebServices.My.ValiPws(pwd,nemail,onsucc); 
    }
}